#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int main()
{
    double price = 0;
    int discount = 0;
    int month = 0;
    int day = 0;
    scanf("%lf%d%d%d", &price, &month, &day, &discount);
    if (month == 11 && day == 11)
    {
        if (discount)
            price = price * 0.7 - 50;
        else
            price *= 0.7;
    }
    else
    {
        if (discount)
            price = price * 0.8 - 50;
        else
            price *= 0.8;
    }
    if (price < 0)
    {
        price = 0;
    }
    printf("%.2f\n", price);

    return 0;
}